package com.tbmob.tb_h5;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;

public class VideoFragmentActivity extends FragmentActivity {

    //com.kwad.sdk.api.KsContentPage mContentPage;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);// 隐藏标题栏
        //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);// 隐藏状态栏

        String codeId = getIntent().getStringExtra("codeId");

        setContentView(R.layout.saas_activity_video);

        ImageView title_iv = findViewById(R.id.a_title_iv);
        title_iv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        //显示短视频
        /*com.tb.mob.config.TbVideoConfig config = new com.tb.mob.config.TbVideoConfig.Builder()
                .codeId(codeId)//平台申请的代码位id
                .containerIdRes(R.id.fragment_container)
                .reward_switch(false)
                .build();
        com.tb.mob.TbVideoManager.replaceFrameLayout4Video(this, config, new com.tb.mob.TbVideoManager.IReplaceListener() {
            @Override
            public void onFail(String msg) {
                finish();
            }

            @Override
            public void getContentPage(com.kwad.sdk.api.KsContentPage contentPage, int containerIdRes) {
                VideoFragmentActivity.this.mContentPage = contentPage;
                getSupportFragmentManager().beginTransaction().replace(containerIdRes, contentPage.getFragment()).commitAllowingStateLoss();
            }

            @Override
            public void onVideoPlayStart(com.ads.admob.bean.VideoTypeEnum videoType) {

            }

            @Override
            public void onVideoPlayPaused(com.ads.admob.bean.VideoTypeEnum videoType) {

            }

            @Override
            public void onVideoPlayResume(com.ads.admob.bean.VideoTypeEnum videoType) {

            }

            @Override
            public void onVideoPlayCompleted(com.ads.admob.bean.VideoTypeEnum videoTypeEnum) {

            }

            @Override
            public void onPageLeave(com.ads.admob.bean.VideoTypeEnum videoTypeEnum) {

            }

            @Override
            public void onRewardVerify() {
                android.widget.Toast.makeText(VideoFragmentActivity.this, "奖励已发放", android.widget.Toast.LENGTH_SHORT).show();
            }
        });*/
    }

    @Override
    public void onBackPressed() {
        /*com.tb.mob.TbVideoManager.cleanVideo();
        if (mContentPage != null && mContentPage.onBackPressed()) {
            return;
        }*/
        super.onBackPressed();
    }
}
